package thread;

public class demo6 {
    private static  int  count = 0;
    public static void main(String[] args) throws InterruptedException {
        Thread t1 = new Thread(() ->{
            for (int i = 0; i <= 5000; i++) {
                count ++;
            }
        });

        Thread t2 = new Thread(() ->{
            for (int i = 0; i <= 5000; i++) {
                count ++;
        }
    });
        t1.start();
        t2.start();
        t1.join();//此行代码写在mai线程中,所以为t1线程联合到main线程当中,当t1线程执行完毕之后,再执行main线程,所谓main等t1线程
        t2.join();
        System.out.println(count);

    }
    

}
